<template>
  <div id="showpop">
    <van-field readonly required name="city" :value="fromdata.city" label="地市:" label-width="3em" />
    <van-field readonly required name="county" :value="fromdata.county" label="县区:" label-width="3em" />
    <van-field readonly required name="competeType" :value="fromdata.competeType" label="项目竞争方式:"
               label-width="7em" />
    <van-field readonly required name="projectModel" :value="fromdata.projectModel" label="项目实施类型:"
               label-width="7em" />
    <van-field readonly required name="publicCountyCodeValue" :value="fromdata.publicCountyCodeValue" label="县域组织(公开市场)：" label-width="10em" />
    <van-field readonly required name="businessId" :value="fromdata.businessId" label="商机编号:" label-width="5em" />
    <van-field readonly required name="projectName" :value="fromdata.projectName" label="商机名称:" label-width="5em" />
    <!-- 商机研判PC暂未上线，手机端先上 -->
    <!--        <van-field readonly required name="isCompleteBusinessJudged" :value="fromdata.isCompleteBusinessJudged" label="商机研判是否完成：" label-width="9em" />-->
    <!--        <van-field readonly required name="businessJudgedPmInsId" :value="fromdata.businessJudgedPmInsId" label="商机研判工单编号：" label-width="9em" />-->

    <!-- 直签 -->
    <div v-if="isZQ">
      <van-field readonly required name="straightCustomerCode" :value="fromdata.straightCustomerCode"
                 label="商机集团单位编码:" label-width="8.5em" />
      <van-field readonly required name="straightCustomerName" :value="fromdata.straightCustomerName"
                 label="商机集团单位名称:" label-width="8.5em" />
      <van-field readonly required name="groupUnitCode"
                 :value="fromdata.groupUnitCode||fromdata.straightCustomerCode" label="决策集团单位编码:" label-width="8.5em" />
      <van-field readonly required name="groupUnitName"
                 :value="fromdata.groupUnitName||fromdata.straightCustomerName" label="决策集团单位名称:" label-width="8.5em" />
      <van-field readonly name="customrOweFee" :value="fromdata.customrOweFee" label="当前客户欠费金额（元）:"
                 label-width="11.5em" />
      <van-field readonly required name="withType" :value="fromdata.withType" label="项目类型:" label-width="5em" />
      <van-field readonly required name="withBusiness" :value="fromdata.withBusiness" label="行业类型:"
                 label-width="5em" />
      <van-field readonly required autosize type="textarea" rows="1" name="straightMakingDescription"
                 :value="fromdata.straightMakingDescription" label="项目描述:" label-width="5em" />
      <van-field readonly required autosize type="textarea" rows="1" name="straightBuildContent"
                 :value="fromdata.straightBuildContent" label="项目建设内容:" label-width="7em" />
      <van-field v-if="fromdata.changeExplain" readonly required autosize type="textarea" rows="1"
                 name="changeExplain" :value="fromdata.changeExplain" label="集团单位信息变更情况说明:" label-width="6.5em" />
      <van-field readonly required name="customerSource" :value="fromdata.customerSource=='1'?'内部用户':'外部用户'" label="客户来源:"
                 label-width="7em" />
      <van-field readonly required name="prepareSignDate" :value="fromdata.prepareSignDate" label="预计签约时间:"
                 label-width="7em" />
    </div>
    <!-- 投标 -->
    <van-cell-group v-if="!isZQ">
      <van-field readonly required name="customerCode" :value="fromdata.customerCode" label="商机集团单位编码:"
                 label-width="8.5em" />
      <van-field readonly required name="customerName" :value="fromdata.customerName" label="商机集团单位名称:"
                 label-width="8.5em" />
      <van-field readonly required name="groupUnitCode" :value="fromdata.groupUnitCode" label="决策集团单位编码:"
                 label-width="8.5em" />
      <van-field readonly required name="groupUnitName" :value="fromdata.groupUnitName" label="决策集团单位名称:"
                 label-width="8.5em" />
      <van-field readonly required name="customrOweFee" :value="fromdata.customrOweFee" label="当前客户欠费金额（元）:"
                 label-width="11.5em" />
      <van-field readonly required name="budgetAmount" :value="fromdata.budgetAmount" label="商机预算(万元):"
                 label-width="8.5em" />
      <van-field readonly required name="budgetTime" :value="fromdata.budgetTime" label="商机录入时间:"
                 label-width="6.5em" />
      <van-field readonly required name="tenderDate" :value="fromdata.tenderDate" label="招标公告日期:"
                 label-width="6.5em" />
      <van-field readonly required name="industryAttribution" :value="fromdata.industryAttribution" label="行业类型:"
                 label-width="5em" />
      <van-field readonly required name="capitalSource" :value="fromdata.capitalSource" label="资金来源:"
                 label-width="5em" />
      <van-field readonly required name="durationRequirement" :value="fromdata.durationRequirement"
                 label="工期要求(天):" label-width="7.5em" />
      <van-field readonly required name="projectBudgetAmount" :value="fromdata.projectBudgetAmount"
                 label="项目预算金额(万元):" label-width="10.5em" />
      <van-field readonly required name="projectOpenBidTime" :value="fromdata.projectOpenBidTime" label="项目开标时间:"
                 label-width="7em" />
      <van-field readonly required autosize type="textarea" rows="1" name="makingDescription"
                 :value="fromdata.makingDescription" label="应标项目描述:" label-width="7em" />
      <van-field readonly required autosize type="textarea" rows="1" name="buildContent"
                 :value="fromdata.buildContent" label="项目建设内容:" label-width="7em" />
      <van-field readonly name="isEmphasis" :value="fromdata.isEmphasis" label="是否共性(重点)项目:"
                 label-width="10.5em" />
      <van-field readonly v-if='isEmphasisName' name="emphasisName" :value="fromdata.emphasisName"
                 label="共性(重点)项目名称:" label-width="10.5em" />
    </van-cell-group>
    <van-cell-group>
      <van-field readonly name="customerUpDate" :value="fromdata.customerUpDate" label="集团客户成立日期:"
                 label-width="8.5em" />
      <van-field readonly name="customerDays" :value="fromdata.customerDays" label="集团客户成立天数:"
                 label-width="8.5em" />
      <van-field readonly name="customerScale" :value="fromdata.customerScale" label="客户单位规模（人数）:"
                 label-width="10.5em" />
      <van-field readonly name="customerAddress" :value="fromdata.customerAddress" label="集团客户注册省份:"
                 label-width="8.5em" />
      <van-field readonly name="type" :value="fromdata.type" label="客户企业类型:"
                 label-width="6.5em" />
      <van-field readonly name="isLogout" :value="fromdata.isLogout" label="客户是否已注销:"
                 label-width="7.5em" />
      <van-field readonly name="isDishonesty" :value="fromdata.isDishonesty" label="客户是否存在违法失信情况:"
                 label-width="12.5em" />
      <van-field readonly name="subconam" :value="fromdata.subconam" label="客户实缴资金额(万元):"
                 label-width="10.5em" />
      <van-field readonly name="registeredCity" :value="fromdata.registeredCity" label="集团客户注册地市:"
                 label-width="8.5em" />
      <van-field readonly name="regCap" :value="fromdata.regCap" label="客户注册资本(万元):"
                 label-width="9.5em" />
    </van-cell-group>

    <!-- 地市会议纪要 -->
    <van-cell-group v-if="chooseMeeting">
      <van-field readonly name="meetingNumber" :value="fromdata.meetingNumber" label="地市会议纪要编号:"
                 label-width="8.5em" />
      <van-field readonly name="meetingTheme" :value="fromdata.meetingTheme" label="地市会议纪要名称:"
                 label-width="8.5em" />
      <van-field readonly name="meetingResult" :value="fromdata.meetingResult" label="地市会议纪要决策结果:"
                 label-width="8em" />
    </van-cell-group>


    <!-- 省公司会议纪要 -->
    <van-cell-group v-if="chooseMeetingCompany">
      <van-field readonly name="meetingNumberCompany" :value="fromdata.meetingNumberCompany" label="省公司会议纪要编号:"
                 label-width="9.5em" />
      <van-field readonly name="meetingThemeCompany" :value="fromdata.meetingThemeCompany" label="省公司会议纪要名称:"
                 label-width="9.5em" />
      <van-field readonly name="meetingCompanyResult" :value="fromdata.meetingCompanyResult" label="省公司会议纪要决策结果:"
                 label-width="8em" />
    </van-cell-group>

    <!-- <van-field v-if="meetingHideCompany" readonly required name="decisionCompleteDate" :value="fromdata.decisionCompleteDate"
        label="公文会议纪要下载链接:" label-width="10.5em" />  -->
    <van-field v-if="hasMeeting" readonly required name="decisionCompleteDate" v-model="fromdata.decisionCompleteDate"
               label="立项决策完成（通过）:" label-width="10.5em" @click="showDatePicker=canEditDSCB" :is-link="canEditDSCB"
               :rules="[{ required: canEditDSCB, message: '请填写立项决策完成（通过）' }]" />

    <van-field readonly required name="implementManage" :value="fromdata.implementManage" label="项目实施管理单位:"
               label-width="9em" />
    <van-field readonly name="projectType" :value="fromdata.projectType" label="效益类型:" label-width="5em" />
    <van-field readonly required name="decisionType" :value="fromdata.decisionType" label="决策类型:"
               label-width="5em" />
    <van-field readonly required name="projectApprovalType" :value="fromdata.projectApprovalType" label="项目立项类型:"
               label-width="6.5em" />
    <van-field readonly required name="buildType" :value="fromdata.buildType" label="立项类型:" label-width="4.5em" />
    <van-field readonly required name="projectServiceContent" :value="fromdata.projectServiceContent"
               label="项目实施类型:" label-width="7em" />
    <van-field readonly required name="projectScaleType" :value="fromdata.projectScaleType" label="项目规模类型:"
               label-width="7em" />
    <van-field readonly required name="configurationName" :value="fromdata.configurationName" label="ICT项目管理模式名称:"
               label-width="10em" />
    <van-field readonly required name="autonomousImplemention" :value="fromdata.autonomousImplemention"
               label="是否自主实施:" label-width="7em" />
    <!-- 是否自主实施 “是” 有这一行 -->
    <van-field readonly required name="autonomousImplementionType"
               :value="fromdata.autonomousImplementionType" label="项目自主实施类型:" label-width="9em" />
    <van-field v-if="fromdata.autonomousImplemention == '是'" readonly required name="autImplementScope"
               :value="fromdata.autImplementScope" label="自主实施范围:" label-width="7em" />
    <van-field readonly required name="btbPaymentMode" :value="fromdata.btbPaymentMode" label="是否背靠背付款模式:"
               label-width="10em" />
    <van-field readonly required name="advanceMoney" :value="fromdata.advanceMoney" label="是否垫资:"
               label-width="5em" />

    <!-- 军团项目 -->
    <van-field readonly required name="isLegionProject"
               :value="fromdata.isLegionProject ? fromdata.isLegionProject : '否'" label="是否军团项目:" label-width="7em"
               :right-icon="isLegionProjectEditable ? 'arrow' : ''"
               @click="isLegionProjectShowPopupView = isLegionProjectEditable"
               :rules="[{ required: isLegionProjectEditable, message: '请选择是否是军团项目' }]" />
    <van-popup v-model="isLegionProjectShowPopupView" position="bottom" get-container="body">
      <van-picker show-toolbar :value-key="'value'" :columns="isLegionProjectPopupColumns"
                  @confirm="isLegionProjectClickConfirm" @cancel="isLegionProjectShowPopupView = false" />
    </van-popup>
    <van-cell-group v-if="fromdata.isLegionProject === '是'">

      <van-field readonly name="industryLegion" :value="fromdata.industryLegion" label="行业军团:" label-width="5em"
                 :right-icon="isLegionProjectEditable ? 'arrow' : ''" @click="industryLegionClick" />
      <van-popup v-model="industryLegionShowPopupView" position="bottom" get-container="body">
        <van-picker show-toolbar :value-key="'value'" :columns="industryLegionPopupColumns"
                    @confirm="industryLegionClickConfirm" @cancel="industryLegionShowPopupView = false" />
      </van-popup>

      <van-field readonly name="productLegion" :value="fromdata.productLegion" label="产品军团:" label-width="5em"
                 :right-icon="isLegionProjectEditable ? 'arrow' : ''" @click="productLegionClick" />
      <van-popup v-model="productLegionShowPopupView" position="bottom" get-container="body">
        <van-picker show-toolbar :value-key="'value'" :columns="productLegionPopupColumns"
                    @confirm="productLegionClickConfirm" @cancel="productLegionShowPopupView = false" />
      </van-popup>
      <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
        军团标签需至少选择其中之一，支持选择两类标签
      </div>

      <van-field readonly name="industryLegionUnits" :value="fromdata.industryLegionUnits" label="行业军团项目支撑单位:"
                 label-width="11em" :right-icon="isLegionProjectEditable ? 'arrow' : ''"
                 @click="industryLegionUnitsClick" />
      <van-popup v-model="industryLegionUnitsShowPopupView" position="bottom" get-container="body">
        <van-picker show-toolbar :value-key="'value'" :columns="industryLegionUnitsPopupColumns"
                    @confirm="industryLegionUnitsClickConfirm" @cancel="industryLegionUnitsShowPopupView = false" />
      </van-popup>

      <van-field readonly name="productLegionUnits" :value="fromdata.productLegionUnits" label="产品军团项目支撑单位:"
                 label-width="11em" :right-icon="isLegionProjectEditable ? 'arrow' : ''"
                 @click="productLegionUnitsClick" />
      <van-popup v-model="productLegionUnitsShowPopupView" position="bottom" get-container="body">
        <van-picker show-toolbar :value-key="'value'" :columns="productLegionUnitsPopupColumns"
                    @confirm="productLegionUnitsClickConfirm" @cancel="productLegionUnitsShowPopupView = false" />
      </van-popup>

      <van-field readonly name="isDifficultProject" :value="fromdata.isDifficultProject" label="是否重点难点项目:"
                 label-width="9em" :right-icon="isLegionProjectEditable ? 'arrow' : ''"
                 @click="isDifficultProjectShowPopupView = isLegionProjectEditable"
                 :rules="[{ required: isLegionProjectEditable, message: '请选择是否重点难点项目' }]" />
      <van-popup v-model="isDifficultProjectShowPopupView" position="bottom" get-container="body">
        <van-picker show-toolbar :value-key="'value'" :columns="isLegionProjectPopupColumns"
                    @confirm="isDifficultProjectClickConfirm" @cancel="isDifficultProjectShowPopupView = false" />
      </van-popup>
      <div v-if="fromdata.isDifficultProject === '是'"
           style="display: flex; justify-content: flex-end; align-items: center; height: 50px;">
        <el-button type="primary" size="small" icon="search" style="margin-right: 16px;"
                   @click="jtxm_lxr_showPopupView = true">
          查看军团联系人
        </el-button>
      </div>
      <page-select-xm-list v-if="jtxm_lxr_showPopupView" v-on:update-flag="jtxm_lxr_showPopupView = false"
                           v-on:select-item="handleSelectItem" pageTitle="军团联系人.列表" url="legionContracts$api$findAll"
                           :withoutKV="{ 'direction': 'desc', 'properties': 'createdTime' }" :withoutBody="{}">
        <template #body="{ item }">
          <div>
            <div class="titlefont"> 军团名称： {{ item.legionName }}</div>
            <div class="infosfont"> 联系人： {{ item.contract }}</div>
            <div class="infosfont"> 电话： {{ item.contractPhone }}</div>
            <div class="infosfont"> 邮箱： {{ item.email }}</div>
          </div>
        </template>
      </page-select-xm-list>

      <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
        重点:战略、头部、战新客户；难点:省公司无法自行解决，需集团特派员协调。
      </div>
      <van-field v-if="fromdata.isDifficultProject === '是'" :readonly="!isLegionProjectEditable" autosize
                 type="textarea" rows="1" name="reason" v-model="fromdata.reason" label="重点难点项目说明:" label-width="9em" />

    </van-cell-group>
    <van-field readonly required name="isVideoNet" :value="fromdata.isVideoNet == 1 ? '是' : '否'" label="是否包含视联网能力:" label-width="11em" />
    <div class="redtext font11" style="margin: 5px 15px 0px 15px;">
      视联网能力说明：当商机内容包含视联网关键字，如“视频、监控、雪亮、应急、摄像头、球机、枪机、千里眼、云视讯、和对讲”等，则选择“是”。
    </div>
    <van-field v-if="fromdata.isVideoNet == 1" readonly required name="connectionsNum" :value="fromdata.connectionsNum" label="视联网能力连接数:" label-width="9em" />
    <!--AI打标签-->
    <van-field readonly required name="isAiAbility" :value="fromdata.isAiAbility == 1 ? '是' : '否'" label="是否包含AI能力:" label-width="8em" />
    <van-field v-if="fromdata.isAiAbility == 1" readonly required name="aiAbilityType" :value="fromdata.aiAbilityType" label="AI能力分类:" label-width="6em" />
    <van-field readonly required name="isIncludeSolution" :value="fromdata.isIncludeSolution == 1 ? '是' : '否'" label="是否包含三化解决方案:" label-width="11em" />
    <div v-if="fromdata.isIncludeSolution == 1">
      <van-field readonly label="三化解决方案信息：" label-width="9em" />
      <el-table :data="fromdata.includeSolutionList" :header-cell-style="{ textAlign: 'center' }" :cell-style="{ textAlign: 'center' }" border
                style="width: 100%">
        <el-table-column prop="solutionInfoName" label="三化方案名称" width="140" />
        <el-table-column prop="solutionInfoCode" label="三化方案编码" width="120" />
        <el-table-column prop="solutionInfoAmount" label="三化预估金额（含税、万元）" width="150" />
      </el-table>
    </div>
    <!--    安全产品-->
    <van-field readonly required name="isSafeProduct" :value="fromdata.isSafeProduct == 1 ? '是' : '否'" label="是否包含安全产品:" label-width="8.5em" />
    <!-- 移动云解决方案 -->
    <van-field readonly required name="isCloudSolution"
               :value="fromdata.isCloudSolution=='1' ? '是' : '否'" label="是否包含移动云解决方案:" label-width="11.5em"/>
    <van-field v-if="fromdata.isCloudSolution === '1'" readonly name="industrySceneScheme" :value="fromdata.industrySceneScheme" label="涉及重点行业场景解决方案:"
               label-width="12.5em"/>
    <!--      <van-cell-group>-->
    <!--        <van-field readonly required name="isCloudSolution"-->
    <!--                   :value="fromdata.isCloudSolution=='1' ? '是' : '否'" label="是否包含移动云解决方案:" label-width="11.5em"-->
    <!--                   :right-icon="isCloudSolutionEditable ? 'arrow' : ''"-->
    <!--                   @click="isCloudSolutionShowPopupView = isCloudSolutionEditable"-->
    <!--                   :rules="[{ required: isCloudSolutionEditable, message: '请选择是否包含移动云解决方案' }]" />-->
    <!--        <van-popup v-model="isCloudSolutionShowPopupView" position="bottom" get-container="body">-->
    <!--          <van-picker show-toolbar :value-key="'name'" :columns="isCloudSolutionPopupColumns"-->
    <!--                      @confirm="isCloudSolutionClickConfirm" @cancel="isCloudSolutionShowPopupView = false" />-->
    <!--        </van-popup>-->
    <!--      </van-cell-group>-->
    <!--      <van-cell-group v-if="fromdata.isCloudSolution === '1'">-->
    <!--        <van-field readonly name="industrySceneScheme" :value="fromdata.industrySceneScheme" label="涉及重点行业场景解决方案:"-->
    <!--                   label-width="12.5em" :right-icon="isCloudSolutionEditable ? 'arrow' : ''"-->
    <!--                   @click="industrySceneSchemeClick" />-->
    <!--        <van-popup v-model="industrySceneSchemeShowPopupView" position="bottom" get-container="body">-->
    <!--          <van-picker show-toolbar :value-key="'name'" :columns="industrySceneSchemePopupColumns"-->
    <!--                      @confirm="industrySceneSchemeClickConfirm" @cancel="industrySceneSchemeShowPopupView = false" />-->
    <!--        </van-popup>-->
    <!--      </van-cell-group>-->
    <van-field readonly name="isSpecialDebt" :value="fromdata.isSpecialDebt == 1 ? '是' : '否'" label="是否专项债："
               label-width="6em" />
    <van-field readonly name="preDecisionStartTime" :value="fromdata.preDecisionStartTime" label="预决策开始时间:"
               label-width="8em" />
    <van-field readonly name="entrustedSalesModel" :value="fromdata.entrustedSalesModel" label="是否受托代销项目:"
               label-width="9em" />
    <van-field readonly name="mainAgentMode" :value="fromdata.mainAgentMode" label-width="6em" label="主代理模式:" />
    <van-field readonly autosize type="textarea" rows="1" name="describe" :value="fromdata.describe" label="其它说明:"
               label-width="5em" />

    <!-- 附件部分 -->
    <div>
      <van-field label-width="10em" readonly label="上会材料：" class="lyy-width" input-align="left" />
      <div v-for="(fileitem) in fromdata.meetingMaterialsFileList" :key="fileitem.id" style="margin-left:20px">
        <div readonly class="font14 fileLink" style="color:#0F85CF">
                    <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
        </div>
      </div>


      <van-field readonly name="makingOpinionsFileList" label="决策意见：" label-width="5em" center>
        <template #button v-if="canUploadMakingOpinionsFileList">
          <van-uploader :after-read="file2server">
            <van-button size="small" type="primary" color="#0f85cf">上传附件</van-button>
          </van-uploader>
        </template>
      </van-field>


      <div v-for="(fileitem, index2) in fromdata.makingOpinionsFileList" :key="fileitem.id"
           style="margin-left: 20px">
        <div readonly class="font14 fileLink" style="color: #0f85cf">
                    <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
        </div>
        <van-icon v-if="canUploadMakingOpinionsFileList" name="close" color="#ea0023" size="20"
                  @click="deleteFile(index2)" />
      </div>
      <div v-if="aiDataResult&&aiDataResult.resultData">
        <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
          <div class="blue_item" />
          <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">AI解析结果</span>
        </div>
        <el-table  :data="aiDataResult.resultData" border style="width: 100%">
          <el-table-column prop="fileName" width="100px" label="文档名称" />
          <el-table-column prop="creator" label="上传人" />
          <el-table-column prop="createdTime" label="上传时间" />
          <el-table-column prop="state" label="AI解析状态" />
        </el-table>
        <div class="mt10" style=" display: flex;border-bottom: 1px solid #ebedf0;">
          <div class="blue_item" />
          <span class="font15" style="display: flex; line-height: 33px;margin-left:5px;  flex:1;">AI解析详情</span>
        </div>
        <el-table  :data="aiDataResult.detailData" border style="width: 100%">
          <el-table-column type="index" width="50px" label="序号" />
          <el-table-column prop="fieldName" label="关键字段名称" />
          <el-table-column prop="dictValue" label="DICT系统数据" />
          <el-table-column prop="aiValue" label="AI解析结果" />
          <el-table-column prop="equalResult" label="一致性对比结果" />
          <el-table-column prop="reEditValue" label="人工修正AI解析结果" width="100px"/>
        </el-table>
      </div>
      <van-field label-width="10em" readonly label="效益评估表：" class="lyy-width" input-align="left" />
      <div v-for="(fileitem) in fromdata.benefitEvaluationFileList" :key="fileitem.id" style="margin-left:20px">
        <div readonly class="font14 fileLink" style="color:#0F85CF">
                    <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
        </div>
      </div>

      <van-field label-width="10em" readonly label="项目建设方案：" class="lyy-width" input-align="left" />
      <div v-for="(fileitem) in fromdata.constructionSchemeFileList" :key="fileitem.id" style="margin-left:20px">
        <div readonly class="font14 fileLink" style="color:#0F85CF">
                    <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
        </div>
      </div>


      <van-field label-width="10em" readonly label="项目决策汇报材料：" class="lyy-width" input-align="left" required
                 placeholder="" />
      <div v-for="(fileitem) in fromdata.projectDecisionFileList" :key="fileitem.id" style="margin-left:20px">
        <div readonly class="font14 fileLink" style="color:#0F85CF">
                    <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
        </div>
      </div>


      <van-field label-width="15em" readonly label="IT部分净现值率自评表：" class="lyy-width" input-align="left" required
                 placeholder="" />
      <div v-for="(fileitem) in fromdata.itNetPresentFileList" :key="fileitem.id" style="margin-left:20px">
        <div readonly class="font14 fileLink" style="color:#0F85CF">
                    <a target="_blank" @click="openFileUrlfun(fileitem.anonymousFilePath)">{{ fileitem.fileName }}</a>
        </div>
      </div>
    </div>

    <!-- 决策层级 控制它是否显隐 -->
    <van-field readonly required name="provinceSupport" :value="fromdata.provinceSupport"
               label="省公司审核处室:" label-width="8em" />
    <!-- 地市公司承办 -->
    <section-header v-if="hasDSCB" :sectionTitle="'地市公司承办'" />
    <van-cell-group v-if="hasDSCB">
      <van-field :readonly="!canEditDSCB" autosize type="textarea" rows="1" name="undertakeOpinion"
                 v-model="fromdata.undertakeOpinion" label="承办意见:" label-width="5em" :is-link="canEditDSCB"/>
      <van-field readonly required :right-icon="canEditDSCB ? 'arrow' : ''" name="cityDecision"
                 :value="fromdata.cityDecision" label="市公司决策结果:" label-width="8em"
                 @click="cityDecisionShow = canEditDSCB" :rules="[{ required: canEditDSCB, message: '请填写市公司决策结果' }]" />
      <van-popup v-model="cityDecisionShow" position="bottom" get-container="body">
        <van-picker show-toolbar value-key="value" :columns="decisionColumns" @confirm="cityDecisionOnConfirm"
                    @cancel="cityDecisionShow = false">
        </van-picker>
      </van-popup>

      <van-field :readonly="!canEditDSCB" autosize type="textarea" rows="1" name="cityDecisionOpinion"
                 v-model="fromdata.cityDecisionOpinion" label="市公司决策意见：" label-width="8em" :is-link="canEditDSCB"/>

      <van-field readonly required :right-icon="canEditDSCB ? 'arrow' : ''" name="cityDecisionDate"
                 :value="fromdata.cityDecisionDate" label="市公司审批时间：" label-width="8em"
                 @click="cityDecisionDateShow = canEditDSCB"
                 :rules="[{ required: canEditDSCB, message: '请填写市公司审批时间' }]" />
      <van-popup v-model="cityDecisionDateShow" position="bottom" get-container="body">
        <van-datetime-picker v-model="currentDate" :formatter="formatter" type="date"
                             @cancel="cityDecisionDateShow = false" @confirm="cityDecisionDateOnConfirm" />
      </van-popup>


      <van-field readonly required name="cityDecisionUndertaker" :value="fromdata.cityDecisionUndertaker"
                 label="市公司承办人：" label-width="7em" :rules="[{ required: canEditDSCB, message: '请填写市公司承办人' }]" />
    </van-cell-group>


    <!-- 省公司承办 -->
    <section-header v-if="hasSGSCB" :sectionTitle="'省公司承办'" />
    <van-cell-group v-if="hasSGSCB">
      <van-field readonly required :right-icon="canEditSGSCB ? 'arrow' : ''" name="provinceDecision"
                 :value="fromdata.provinceDecision" label="省公司决策结果：" label-width="8em"
                 @click="provinceDecisionShow = canEditSGSCB"
                 :rules="[{ required: canEditSGSCB, message: '请填写省公司决策结果' }]" />
      <van-popup v-model="provinceDecisionShow" position="bottom" get-container="body">
        <van-picker show-toolbar value-key="value" :columns="decisionColumns"
                    @confirm="provinceDecisionOnConfirm" @cancel="provinceDecisionShow = false">
        </van-picker>
      </van-popup>

      <van-field :readonly="!canEditSGSCB" autosize type="textarea" rows="1" name="provinceDecisionOpinion"
                 v-model="fromdata.provinceDecisionOpinion" label="省公司决策意见：" label-width="8em" />

      <van-field readonly required :right-icon="canEditSGSCB ? 'arrow' : ''" name="provinceDecisionDate"
                 :value="fromdata.provinceDecisionDate" label="省公司审批时间：" label-width="8em"
                 @click="provinceDecisionDateShow = canEditSGSCB"
                 :rules="[{ required: canEditSGSCB, message: '请填写省公司审批时间' }]" />
      <van-popup v-model="provinceDecisionDateShow" position="bottom" get-container="body">
        <van-datetime-picker v-model="currentDate" :formatter="formatter" type="date"
                             @confirm="provinceDecisionDateOnComfirm" @cancel="provinceDecisionDateShow = false" />
      </van-popup>
      <van-field readonly required name="provinceDecisionUndertaker" :value="fromdata.provinceDecisionUndertaker"
                 label="省公司承办人：" label-width="7em" :rules="[{ required: canEditSGSCB, message: '请填写省公司承办人' }]" />
    </van-cell-group>


    <!-- 当前办理人 -->
    <section-header v-if="showHistory" :sectionTitle="'当前办理人：'" />
    <div v-if="showHistory" class="font13 ptandpb10 pl16">
      <div>
                <span class="titletext font13">{{
                    historydata.MANAGER
                  }}</span>
      </div>
      <div class="mt5">
        <span class="graytext font12">{{ historydata.DEPARTMENT }}</span>
      </div>
    </div>


    <!-- 审批意见 -->
    <section-header id="opinion" :sectionTitle="'审批意见：'" />
    <opinion-item :approveList="approveList" />
    <van-popup v-model="showDatePicker" position="bottom" get-container="body">
      <van-datetime-picker v-model="currentDate" :formatter="formatter" type="date"
                           @cancel="showDatePicker = false" @confirm="decisionCompleteDateOnConfirm" />
    </van-popup>
  </div>
</template>
 
<script>

import { openFileUrl } from '@/store/openFile'
import OpinionItem from '../sztdzj/sztdzjDetail/opinion-item.vue';
import SectionHeader from '../sztdzj/sztdzjDetail/section-header.vue';
import moment from 'moment'
import { mapGetters } from 'vuex';
import jTool from "@/assets/js/jHelper";
import {req, uploadFileCommon} from "@/api/dictapi";
import { getDictList } from "@/api/dictapi";
import {Notify, Toast} from 'vant';
import PageSelectXmList from '/src/components/page_select_xm_list/index.vue';
import util from "@/assets/js/public";


export default {
    data() {
        return {

            showDatePicker: false,
            hasMeeting: false,  /// 地市会议纪要
            hasMeetingCompany: false,  /// 省公司会议纪要

            chooseMeeting: false,  /// 地市会议纪要 可编辑（可弹窗）
            chooseMeetingCompany: false,  /// 省公司会议纪要 可编辑（可弹窗）

            hasAlert:false,
            isEmphasisName:true,
            hasDSCB: false,     /// 地市承办
            hasSGSCB: false,    /// 省公司承办
          
            canEditDSCB: false,
            canEditSGSCB: false,
            canUploadMakingOpinionsFileList: false, /// 决策意见 是否可以上传

            decisionColumns: [{ label: '同意', value: '同意' }, { label: '不同意', value: '不同意' }],
            currentDate: new Date(),

            cityDecisionShow: false,
            cityDecisionDateShow: false,

            provinceDecisionShow: false,
            provinceDecisionDateShow: false,

            isLegionProjectShowPopupView: false,
            isLegionProjectPopupColumns: [{ 'name': '是', 'value': '是' },
            { 'name': '否', 'value': '否' }],
            isDifficultProjectShowPopupView: false,
            industryLegionShowPopupView: false,
            industryLegionPopupColumns: [],

            industryLegionDict: {
                '安全+军团': '启明星辰',
                '视觉+军团': '物联网公司',
                '智慧公安军团': '集成公司',
                '应急管理军团': '集成公司',
                '新型工业化军团': '上研院',
                '智慧校园军团': '成研院',
                'AI+军团': '云能力中心',
                '车联网军团': '上研院'
            }, // 各军团和专业公司对应关系

            industryLegionUnitsShowPopupView: false,
            industryLegionUnitsPopupColumns: [],

            productLegionShowPopupView: false,
            productLegionPopupColumns: [],

            productLegionUnitsShowPopupView: false,
            productLegionUnitsPopupColumns: [],

            jtxm_lxr_showPopupView: false,
          //   isCloudSolutionEditable:true,
          //   isCloudSolutionShowPopupView: false,
          //   isCloudSolutionPopupColumns: [{ 'name': '是', 'value': '1' },
          //     { 'name': '否', 'value': '0' }],
          //   industrySceneSchemeShowPopupView:false,
          // industrySceneSchemePopupColumns: [],
        }
    },

    props: ['fromdata', 'showHistory', 'historydata', 'approveList', 'todoType', 'workItemName', 'pmInsType', 'location','aiDataResult'],

    watch: {
        fromdata: {

            handler() {
                //这是vue的规定写法，当你watch的值发生变化的时候，就会触发这个handler，这是vue内部帮你做的事情
                console.log('changeFromdata list changed')

                 this.checkMeetingsAndCB();
            },

            deep: true,  // 可以深度检测到 obj 对象的属性值的变化
            immediate: true //刷新加载  立马触发一次handler
        },
    },

    created() {

    },

    methods: {
        
        tomsg() {
            document.getElementById('opinion').scrollIntoView({ behavior: 'smooth' })
        },

        openFileUrlfun(value) {
            this.$router.push(
                {
                    name: 'fileview',
                    query: {
                        openFileUrl: openFileUrl(value)
                    }
                }
            );
        },

        file2server(file) {
            let fileData = new FormData();
            fileData.append("pmInsType", this.pmInsType);
            fileData.append("pmInsTypePart", "1");
            fileData.append("files", file.file);

            let params = new Map();
            params.pmInsType = this.pmInsType;
            params.pmInsTypePart = '1';
            params.userName = this.user.userName;
            uploadFileCommon(fileData, params).then((res) => {
                if (!res.data) {
                    Notify(res.message);
                    return;
                }
                if (res.data.data) {
                    if (this.fromdata.makingOpinionsFileList === null) {
                        this.fromdata.makingOpinionsFileList = [];
                    }
                    this.fromdata.makingOpinionsFileList.push(res.data.data.sysFiles[0]);
                }
            });
        },

        deleteFile(index) {
            Dialog.confirm({ title: "提示", message: "是否删除此附件？" })
                .then(() => {
                    this.fromdata.handleFile.splice(index, 1);
                })
                .catch(() => { });
        },

        formatter(type, val) {
            if (type === 'year') {
                return `${val}年`;
            }
            else if (type === 'month') {
                return `${val}月`;
            } else if (type === 'day') {
                return `${val}日`;
            }

            return val;
        },

        // 查看联系人信息，点击无回调
        handleSelectItem(value) {

            this.jtxm_lxr_showPopupView = false;

        },

        // TODO: 网络请求
        requestAlertInfo(value, callback) {

            Toast.loading({ message: "加载中", forbidClick: false });
            getDictList(value, { userName: this.user.userName }).then((result) => {
                Toast.clear();
                if (!result.data) {
                    Notify(result.message);
                    return;
                }

                if (result.data.data) {
                    callback(result.data.data);
                }
            });
        },


        // TODO:弹窗显示
        industryLegionClick() {

            if (this.isLegionProjectEditable) {

                if (this.industryLegionPopupColumns.length == 0) {

                    this.requestAlertInfo('industryLegion', (data) => {

                        this.industryLegionPopupColumns = data;
                        this.industryLegionShowPopupView = true;
                    });
                }
                else {
                    this.industryLegionShowPopupView = true;
                }
            }
        },

        productLegionClick() {

            if (this.isLegionProjectEditable) {
                if (this.productLegionPopupColumns.length == 0) {

                    this.requestAlertInfo('productLegion', (data) => {

                        this.productLegionPopupColumns = data;
                        this.productLegionShowPopupView = true;
                    });
                }
                else {
                    this.productLegionShowPopupView = true;
                }
            }

        },

        industryLegionUnitsClick() {

            if (this.isLegionProjectEditable) {
                if (this.industryLegionUnitsPopupColumns.length == 0) {

                    this.requestAlertInfo('legionUnits', (data) => {

                        this.industryLegionUnitsPopupColumns = data;
                        this.industryLegionUnitsShowPopupView = true;
                    });
                }
                else {
                    this.industryLegionUnitsShowPopupView = true;
                }

            }

        },

        productLegionUnitsClick() {

            if (this.isLegionProjectEditable) {

                if (this.productLegionUnitsPopupColumns.length == 0) {

                    this.requestAlertInfo('legionUnits', (data) => {

                        this.productLegionUnitsPopupColumns = data;
                        this.productLegionUnitsShowPopupView = true;
                    });
                }
                else {
                    this.productLegionUnitsShowPopupView = true;
                }
            }

        },

        // TODO: 弹窗回调事件
        isLegionProjectClickConfirm(value) {

            this.isLegionProjectShowPopupView = false;
            this.fromdata.isLegionProject = value.name;
        },

        isDifficultProjectClickConfirm(value) {

            this.isDifficultProjectShowPopupView = false;
            this.fromdata.isDifficultProject = value.name;
        },

        industryLegionClickConfirm(value) {

            this.industryLegionShowPopupView = false;
            this.fromdata.industryLegion = value.name;

            let val = this.industryLegionDict[value.name];
            this.fromdata.industryLegionUnits = val;
        },

        industryLegionUnitsClickConfirm(value) {

            this.industryLegionUnitsShowPopupView = false;
            this.fromdata.industryLegionUnits = value.name;
        },

        productLegionClickConfirm(value) {

            this.productLegionShowPopupView = false;
            this.fromdata.productLegion = value.name;

            let val = this.industryLegionDict[value.name];
            this.fromdata.productLegionUnits = val;
        },

        productLegionUnitsClickConfirm(value) {

            this.productLegionUnitsShowPopupView = false;
            this.fromdata.productLegionUnits = value.name;
        },


        cityDecisionOnConfirm(value) {

            this.cityDecisionShow = false;
            this.fromdata.cityDecision = value.value;
            this.chooseMeeting = value.value == '同意';

            if (value == "同意") {
               this.hasMeeting=true;
            } else {
               this.hasMeeting=false;
            }
        },

        cityDecisionDateOnConfirm(value) {

            this.cityDecisionDateShow = false;
            this.fromdata.cityDecisionDate = moment(value).format('YYYY-MM-DD');
        },
        decisionCompleteDateOnConfirm(value) {
            this.showDatePicker = false;
            this.fromdata.decisionCompleteDate = moment(value).format('YYYY-MM-DD');
        },
        provinceDecisionOnConfirm(value) {

            this.provinceDecisionShow = false;
            this.fromdata.provinceDecision = value.value;

            this.chooseMeetingCompany = value.value == '同意';
            if (value == "同意") {
               this.hasMeetingCompany=true;
            } else {
               this.hasMeetingCompany=false;
            }
        },

        provinceDecisionDateOnComfirm(value) {

            this.provinceDecisionDateShow = false;
            this.fromdata.provinceDecisionDate = moment(value).format('YYYY-MM-DD');
        },



        /// 地市承办 且可操作
        setCityUndertake() {

            this.hasDSCB = true;
            this.hasMeeting = true;

            this.chooseMeeting = true;

            this.canEditDSCB = true;
            this.canUploadMakingOpinionsFileList = true;

            if (jTool.stringIsEmpty(this.fromdata.cityDecisionDate)) {
                var day2 = new Date();
                day2.setTime(day2.getTime());
                this.fromdata.cityDecisionDate = day2.getFullYear() + "-" + (day2.getMonth() + 1) + "-" + day2.getDate();
                this.fromdata.cityDecisionUndertaker = this.userinfo.truename;
            }
        },


        /// 省公司会议纪要、地市会议纪要
        /// 地市承办、省公司承办
        checkMeetingsAndCB() {

            var decisionLevel = this.fromdata.decisionLevel;
            var provinceDecision = this.fromdata.provinceDecision;
            var cityDecision = this.fromdata.cityDecision;
            var workItemName = this.workItemName;
            var location = this.location;
            this.chooseMeeting = cityDecision == '同意';
            this.chooseMeetingCompany = provinceDecision == '同意';

            // 请市公司标前决策管理员审批 dict.cityDeliveryAdminToCityAdmin
            // 请政企部审批(市公司) dict.cityDeliveryAdminToCityAdmin
            // 请领导审批 dict.cityAdminToLead
            if (location == "dict.cityDeliveryAdminToCityAdmin"|| 
                location == "dict.hkLeadToCityLead" || 
                location == "dict.cityAdminToLead") {
                
                this.setCityUndertake();

                this.canEditDSCB = true;
                this.chooseMeeting = true;
                this.hasMeeting = true;

                // 市公司政企部审批时放开 决策意见文件上传字段
                this.canUploadMakingOpinionsFileList = true;
            } 


            // 请省标前决策管理员审批 dict.cityDeliveryAdminToIndustryAdmin
            // 请省公司标前决策管理员审批(省行客) dict.specialToIndustryAdmin
            // 会签通过 dict.agree
            // 会签不通过 dict.noAgree
            if (location == "dict.cityDeliveryAdminToIndustryAdmin"|| 
                location == "dict.industryAdminToProvincialAdmin"|| 
                location == "dict.provincialAdminToAgree"|| 
                location == "dict.specialToIndustryAdmin"|| 
                location == "dict.agree"|| 
                location == "dict.noAgree"|| 
                location == "dict.industryAdminToProvincialCompany") {

                this.hasSGSCB = true;
                this.hasMeetingCompany = true;
                this.hasMeeting=true;
                if (this.userinfo.belongCompanyTypeDictValue == "01" &&
                    jTool.stringIsEmpty(provinceDecision)) {
                    this.chooseMeetingCompany = true;
                    this.hasAlert = true;
                }

                if (location != "dict.specialToIndustryAdmin" && 
                    !jTool.stringIsEmpty(this.fromdata.cityDecision)) {
                    this.hasDSCB = true;
                    this.chooseMeeting = true;
                }

                this.hasSGSCB = true;
                this.hasMeeting = true;

                this.canEditSGSCB = true;
                this.canUploadMakingOpinionsFileList = true;
                if (jTool.stringIsEmpty(this.fromdata.provinceDecisionDate)) {

                    var day2 = new Date();
                    day2.setTime(day2.getTime());
                    this.fromdata.provinceDecisionDate = day2.getFullYear() + "-" + (day2.getMonth() + 1) + "-" + day2.getDate();
                    this.fromdata.provinceDecisionUndertaker = this.userinfo.truename;
                }

            }


            if (!jTool.stringIsEmpty(this.fromdata.meetingNumber)) {
                this.hasMeeting = true;
                this.chooseMeeting=true;
            }
            if (this.fromdata.isEmphasis=='否') {
                this.isEmphasisName = false;
            }
            
            
            if (location == "dict.toStart" || location == "dict.copy") {
                
                if (!jTool.stringIsEmpty(cityDecision)) {
                    this.hasDSCB = true;
                }

                if (!jTool.stringIsEmpty(provinceDecision)) {
                    this.hasSGSCB = true;
                    this.hasMeeting = true;
                    this.hasMeetingCompany = true;
                }
            }

            if (location == "end") {
                this.hasDSCB = true;
                this.hasSGSCB = true;
                this.hasMeetingCompany = true;
                this.hasMeeting = true;
            }

            /// 已办不可编辑
            if (!this.todoType) {

                this.canEditDSCB = false;
                this.canEditSGSCB = false;
            }
        },
      //移动云相关下拉框和弹窗配置
        // isCloudSolutionClickConfirm(value) {
        //   this.isCloudSolutionShowPopupView = false;
        //   this.fromdata.isCloudSolution = value.value;
        // },
        // industrySceneSchemeClick() {
        //   if (this.isCloudSolutionEditable) {
        //     if (this.industrySceneSchemePopupColumns.length == 0) {
        //       let dictType=""
        //       if(this.fromdata.competeType == '直签'){
        //         dictType=this.fromdata.withBusiness
        //       }else {
        //         dictType= this.fromdata.industryAttribution
        //       }
        //       req("dict","queryDictValue$api$queryByTypeBody",{
        //         kv : {currentUserCode: util.encrypt(this.user.userName),source: "MOBILE",userName: this.user.userName,
        //           dictType: dictType},
        //         body:{
        //           dictType: dictType
        //         }
        //       }).then((result) => {
        //         Toast.clear();
        //         if (!result.data) {
        //           Notify(result.message);
        //           return;
        //         }
        //         this.industrySceneSchemePopupColumns = result.data.data;
        //         this.industrySceneSchemeShowPopupView = true;
        //       })
        //     }
        //     else {
        //       this.industrySceneSchemeShowPopupView = true;
        //     }
        //   }
        // },
        // industrySceneSchemeClickConfirm(value) {
        //   this.industrySceneSchemeShowPopupView = false;
        //   this.fromdata.industrySceneScheme = value.name;
        // },
    },

    computed: {
        ...mapGetters(["userinfo"]),
        ...mapGetters(["user"]),

        /// 直签、投标
        isZQ() {

            return this.fromdata.competeType == '直签';
        },

        // 军团项目 可否编辑
        isLegionProjectEditable() {
            return this.location === 'dict.start' && this.todoType == "1";
        },
    },

    //生命周期--挂载完成
    components: {

        OpinionItem,
        SectionHeader,
        PageSelectXmList
    },

}
</script>
 
<style lang="scss" scoped></style>